package snucse.teamd.math;


public class MyMath {
	public static double random(){	// range(-1,1)
		double r = Math.random();
		r = 2.0f * r - 1.0f;
		return r;
	}
	public static double random(float lo, float hi){
		double r = Math.random();
		r = (hi-lo) * r + lo;
		return r;
	}
	
	public static Vec2 rotation(Vec2 v, Vec2 position, double angle){
		Vec2 result;
		
		double cos_theta = Math.cos(angle);
		double sin_theta = Math.sin(angle);
		Vec2 temp = Vec2.minus(v, position);
		
				
		result = new Vec2(temp.getX()*cos_theta - temp.getY()*sin_theta
						, temp.getY()*cos_theta + temp.getX()*sin_theta);
		result = Vec2.plus(result, position);
				
		return result;
	}
}
